package com.example.administrator.managesystem.network;

import com.example.administrator.managesystem.bean.AddCameraSeriesBean;
import com.example.administrator.managesystem.bean.AddLandBean;
import com.example.administrator.managesystem.bean.CameraListBean;
import com.example.administrator.managesystem.bean.CodeBean;
import com.example.administrator.managesystem.bean.CollectBean;
import com.example.administrator.managesystem.bean.CollectCircleBean;
import com.example.administrator.managesystem.bean.CollectWikiBean;
import com.example.administrator.managesystem.bean.DeleteCameraBean;
import com.example.administrator.managesystem.bean.DeleteGoodsBean;
import com.example.administrator.managesystem.bean.DeleteLandBean;
import com.example.administrator.managesystem.bean.FirstPageRecommandResult;
import com.example.administrator.managesystem.bean.ForgetPsdBean;
import com.example.administrator.managesystem.bean.GetCameraBean;
import com.example.administrator.managesystem.bean.GoodsListBean;
import com.example.administrator.managesystem.bean.HeadChangeBean;
import com.example.administrator.managesystem.bean.HiKTokenBean;
import com.example.administrator.managesystem.bean.LandListBean;
import com.example.administrator.managesystem.bean.LoginBean;
import com.example.administrator.managesystem.bean.LogoResult;
import com.example.administrator.managesystem.bean.MyCircleBean;
import com.example.administrator.managesystem.bean.MyShareCircleBean;
import com.example.administrator.managesystem.bean.ProfileChangeBean;
import com.example.administrator.managesystem.bean.ProfileInfoBean;
import com.example.administrator.managesystem.bean.PsdSettingBean;
import com.example.administrator.managesystem.bean.RegisterBean;
import com.example.administrator.managesystem.bean.RepostBean;
import com.example.administrator.managesystem.bean.ScanGoodsBean;
import com.example.administrator.managesystem.bean.SendCircleBean;
import com.example.administrator.managesystem.bean.ShareCircleBean;
import com.example.administrator.managesystem.bean.ShareWikiBean;
import com.example.administrator.managesystem.bean.TagBean;
import com.example.administrator.managesystem.bean.UpdateGoodsBean;
import com.example.administrator.managesystem.bean.UpdateLandBean;
import com.example.administrator.managesystem.bean.UploadBean;
import com.example.administrator.managesystem.bean.UploadGoodsBean;
import com.example.administrator.managesystem.bean.WikiDetailBean;
import com.example.administrator.managesystem.bean.WikiListBean;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import rx.Observable;


public interface GuideAPI {
    //注册
    @Multipart
    @POST("/register")

    Observable<RegisterBean> register(@Query("telphone") String telphone,
                                      @Query("auth_type") String auth_type,
                                      @Query("name") String name,
                                      @Query("verify_code") String verify_code,
                                      @Query("province") String province,
                                      @Query("city") String city,
                                      @Query("area") String area,
                                      @Query("address") String address,
                                      @Part MultipartBody.Part file
                                      );
    //登录
    @POST("/login")
    Observable<LoginBean> login(@Query("telphone") String telphone,
                                @Query("password") String password);
    //获取验证码
    @GET("/verify")
    Observable<CodeBean> code(@Query("telphone") String telphone);

    //一键登录
    @POST("/login")
    Observable<LoginBean> oneShotLogin(@Query("telphone") String telphone,
                                @Query("verify_code") String verify_code
    );

    //忘记密码
    @POST("/password_find")
    Observable<ForgetPsdBean> forgetPsd(@Query("telphone") String telphone,
                                        @Query("verify_code") String verify_code,
                                        @Query("password") String password,
                                        @Query("confirm_password") String confirm_password
    );

    //修改密码
    @POST("/users/{user_id}/modify_password")
    Observable<PsdSettingBean> psdSetting(@Path("user_id") String user_id,
                                          @Query("token") String token,
                                          @Query("old_pwd") String old_pwd,
                                          @Query("password") String password,
                                          @Query("confirm_password") String confirm_password
    );
    //修改头像
    @Multipart
    @POST("/users/{user_id}/modify_headimg")//token，head_img
    Observable<HeadChangeBean> headSetting(@Path("user_id") String user_id,
                                           @Query("token") String token,
                                           @Part MultipartBody.Part file

    );
    //保存个人信息
    @PUT("/farmers/{user_id}")
    Observable<ProfileChangeBean> ProfileChangeRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("name") String name,
            @Query("sex") String sex,
            @Query("province") String province,
            @Query("city") String city,
            @Query("area") String area,
            @Query("age") String age,
            @Query("address") String address,
            @Query("remarks") String remarks,
            @Query("labels")List<String> list
            );
    //个人信息
    @GET("/users/{user_id}")
    Observable<ProfileInfoBean> profileInfoRequest(
            @Path("user_id") String user_id,
            @Query("token") String token

    );

    //我发的圈
    @GET("/breedings")
    Observable<MyShareCircleBean> MyShareRequest(
            @Query("user_id") String user_id,
            @Query("token") String token,
            @Query("page") int page,
            @Query("pageSize") int pageSize

    );

    //种养圈发布
    @Multipart
    @POST("/farmers/{user_id}/breedings")
    Observable<SendCircleBean> MySendRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("content") String content,
            @Query("address") String address,
            @Part List<MultipartBody.Part> partList

    );
    //添加追溯信息
    @Multipart
    @POST("/users/{user_id}/tracebacks")
    Observable<ScanGoodsBean> uploadTracks(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("start_code") String start_code,
            @Query("number") int number,
            @Query("category_id") String category_id,
            @Query("username") String username,
            @Query("telphone") String telphone,
            @Query("address") String address,
            @Query("date") String date,
            @Part List<MultipartBody.Part> partList

    );
    //种养圈收藏
    @POST("/farmers/{user_id}/breedings/{breeding_id}/collections")
    Observable<CollectBean> CollectCircleRequest(
            @Path("user_id") String user_id,
            @Path("breeding_id") String breeding_id,
            @Query("token") String token


    );

    //农业百科收藏
    @POST("/farmers/{user_id}/wikis/{wiki_id}/collections")
    Observable<CollectBean> CollectWikiRequest(
            @Path("user_id") String user_id,
            @Path("wiki_id") String wiki_id,
            @Query("token") String token


    );


    //种养圈分享
    @POST("/farmers/{user_id}/breedings/{breeding_id}/shares")
    Observable<RepostBean> shareCircleRequest(
            @Path("user_id") String user_id,
            @Path("breeding_id") String breeding_id,
            @Query("token") String token
    );
  ///farmers/<user_id>/wikis/<wiki_id>/shares
     //农业百科分享
     @POST("/farmers/{user_id}/wikis/{wiki_id}/shares")
     Observable<RepostBean> shareWikiRequest(
        @Path("user_id") String user_id,
        @Path("wiki_id") String wiki_id,
        @Query("token") String token
);

    //获取萤石云token
    @GET("/farmers/{user_id}/hk_token")
    Observable<HiKTokenBean> getToken(
            @Path("user_id") String user_id,
            @Query("token") String token
    );

    //农业百科列表
    @GET("/wikis")
    Observable<WikiListBean> wikiRequest(
            @Query("pageSize") int pageSize,
            @Query("last_time") String last_time
    );

    //农业百科详情
    @GET("/wikis/{wiki_id}")
    Observable<WikiDetailBean> wikiDetailRequest(
            @Path("wiki_id") String wiki_id,
            @Query("user_id") String user_id
    );
    //添加土地  token,name,goods_id，image
    @Multipart
    @POST("/farmers/{user_id}/lands")
    Observable<AddLandBean> addLandRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("name") String name,
            @Query("goods_id") String goods_id,
            @Query("location") String location,
            @Part MultipartBody.Part file
    );
    //添加种类
    @GET("/goods_categories")
    Observable<TagBean> goodsTypeRequest();

    //我的土地列表
    @GET("/farmers/{user_id}/lands")
    Observable<LandListBean> landListRequest(@Path("user_id") String user_id,
                                             @Query("token") String token);
    //添加摄像头
    @POST("/farmers/{user_id}/lands/{land_id}/cameras")
    Observable<AddCameraSeriesBean> addCameraRequest(@Path("user_id") String user_id,
                                                     @Path("land_id") String land_id,
                                                     @Query("token") String token,
                                                     @Query("device_number") String device_number);

    //获取摄像头
    @GET("/farmers/{user_id}/lands/{land_id}/cameras")
    Observable<GetCameraBean> getCameraRequest(@Path("user_id") String user_id,
                                               @Path("land_id") String land_id,
                                               @Query("token") String token);


    //删除摄像头
    @DELETE("/farmers/{user_id}/lands/{land_id}/cameras/{camera_id}")
    Observable<DeleteCameraBean> deleteCameraRequest(@Path("user_id") String user_id,
                                                     @Path("land_id") String land_id,
                                                     @Path("camera_id") String camera_id,
                                                     @Query("token") String token);
    //摄像头列表
    @GET("/farmers/{user_id}/lands/{land_id}/cameras")
    Observable<CameraListBean> cameraListRequest(@Path("user_id") String user_id,
                                                 @Path("land_id") String land_id,
                                                 @Query("token") String token);
    //检查商品是否有视频或图片
    @GET("/farmers/{user_id}/lands/{land_id}/check_album")
    Observable<UploadBean> checkVPRequest(@Path("user_id") String user_id,
                                          @Path("land_id") String land_id,
                                          @Query("token") String token);
    //上传商品
    @Multipart
    @POST("/farmers/{user_id}/expected_sales")//
    Observable<UploadGoodsBean> addGoodsRequest(@Path("user_id") String user_id,
                                                @Query("token") String token,
                                                @Query("land_id") String land_id,
                                                @Query("title") String title,
                                                @Query("price") String price,
                                                @Query("number") String number,
                                                @Part MultipartBody.Part file,
                                                @Part List<MultipartBody.Part> partList
    );

    //上传商品
    @POST("/farmers/{user_id}/expected_sales")//
    Observable<UploadGoodsBean> addGoodsRequestOK(@Path("user_id") String user_id,
                                                @Query("token") String token,
                                                @Query("land_id") String land_id,
                                                @Query("title") String title,
                                                @Query("price") String price,
                                                @Query("number") String number

    );
    //商品列表
    @GET("/farmers/{user_id}/expected_sales")
    Observable<GoodsListBean> goodsListRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("page") int page,
            @Query("pageSize") int pageSize

    );

    //删除商品
    @DELETE("/farmers/{user_id}/expected_sales")
    Observable<DeleteGoodsBean> deleteGoodsRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("sale_ids") List<Integer> list

    );

    //我发的圈
    @GET("/farmers/{user_id}/breedings")
    Observable<MyCircleBean> myCircleRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("page") int page,
            @Query("pageSize") int pageSize

    );
    //我的分享 wiki
    @GET("/users/{user_id}/shares")
    Observable<ShareWikiBean> myShareWikiRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("page") int page,
            @Query("pageSize") int pageSize,
            @Query("type") String type

    );
    //我的分享 circle
    @GET("/users/{user_id}/shares")
    Observable<ShareCircleBean> myShareCircleRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("page") int page,
            @Query("pageSize") int pageSize,
            @Query("type") String type

    );
    //我的收藏 wiki
    @GET("/users/{user_id}/collections")
    Observable<CollectWikiBean> myCollectWikiRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("page") int page,
            @Query("pageSize") int pageSize,
            @Query("type") String type

    );

    //我的收藏 circle
    @GET("/users/{user_id}/collections")
    Observable<CollectCircleBean> myCollectCircleRequest(
            @Path("user_id") String user_id,
            @Query("token") String token,
            @Query("page") int page,
            @Query("pageSize") int pageSize,
            @Query("type") String type

    );

    //删除土地
    @DELETE("/farmers/{user_id}/lands/{land_id}")
    Observable<DeleteLandBean> deleteLandRequest(
            @Path("user_id") String user_id,
            @Path("land_id") String land_id,
            @Query("token") String token

    );
    //更新土地   token,name,goods_id，image(可不传),
    //location
    @Multipart
    @PUT("/farmers/{user_id}/lands/{land_id}")
    Observable<UpdateLandBean> updateLandRequest(
            @Path("user_id") String user_id,
            @Path("land_id") String land_id,
            @Query("token") String token,
            @Query("name") String name,
            @Query("goods_id") String goods_id,
            @Query("location") String locayion,
            @Part MultipartBody.Part file

    );

    ///farmers/<user_id>/expected_sales/<sale_id>
 //修改商品信息
    @PUT("/farmers/{user_id}/expected_sales/{sale_id}")
    Observable<UpdateGoodsBean> updateGoodsRequest(
            @Path("user_id") String user_id,
            @Path("sale_id") int sale_id,
            @Query("token") String token,
            @Query("price") String price,
            @Query("number") String number



    );

}
